import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class Film {
    private static HashMap<String, List<String>> filmList = new HashMap<>();
    private static HashMap<String, Long> filmSale = new HashMap<>();

    public static HashMap<String, Long> getFilmSale(){
        return filmSale;
    }

    public static float getFilmScore(String key){
        return Float.parseFloat(filmList.get(key).get(4));
    }

    public static void addFilmSale(String filmName,Long sale){
        filmSale.put(filmName,sale);
    }
    public static HashMap<String, List<String>> getFilmList(){
        return filmList;
    }

    public static void addFilm(String filmName, String editorName, String starring, String introduction, String filmTime, String score ,String release){
        filmList.put(filmName,new ArrayList<>());
        filmList.get(filmName).add(editorName);
        filmList.get(filmName).add(starring);
        filmList.get(filmName).add(introduction);
        filmList.get(filmName).add(filmTime);
        filmList.get(filmName).add(score);
        filmList.get(filmName).add(release);
        filmSale.put(filmName,0L);

    }

    public static void deleteFilm(String filmName){
        filmSale.remove(filmName);
        filmList.remove(filmName);
    }

    public static void updateFilmName(String filmName,String newName,ArrayList<String> Info,Long sale){
        filmList.put(newName,Info);
        filmSale.put(newName,sale);
        filmList.remove(filmName);
        filmSale.remove(filmName);
    }

    public static void updateFilmEditorName(String filmName,String newEditorName){
        filmList.get(filmName).set(0,newEditorName);
    }
    public static void updateFilmStarring(String filmName,String newStarring){
        filmList.get(filmName).set(1,newStarring);
    }
    public static void updateFilmIntroduction(String filmName,String newIntroduction){
        filmList.get(filmName).set(2,newIntroduction);
    }
    public static void updateFilmTime(String filmName,String newFilmTime){
        filmList.get(filmName).set(3,newFilmTime);
    }
    public static void updateFilmScore(String filmName,String newScore){
        filmList.get(filmName).set(4,newScore);
    }
}
